﻿using MyAttribute.Extend;
using MyAttribute.ModelValidate;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyAttribute
{
    public class UserInfo
    {
        public int Id { get; set; }

        [CustomLengthAttribute(2, 10, ErrorMessage = "用户姓名长度要在2-10之间")]
        [CustomRequired(ErrorMessage = "名称不能为空")]
        public string Name { get; set; }

        public int Age { get; set; }

        public long QQ { get; set; }

        [CustomLengthAttribute(11, 11, ErrorMessage = "手机号必须是11位")]
        [CustomRequired(ErrorMessage = "手机号不能为空")]
        public string Mobile { get; set; }

        /// <summary>
        /// 用户的状态
        /// </summary>
        public UserStateEnum State { get; set; }


        public string StrDescription
        {
            get
            {
                return this.State.GetDescription();
            }
        }
    }
}
